//
//  CampusListSearchItemCell.m
//  ShowYork
//
//  Created by hxh on 2021/3/26.
//  Copyright © 2021 hxh. All rights reserved.
//

#import "CampusListSearchItemCell.h"

@interface CampusListSearchItemCell ()
@property (nonatomic,strong)UILabel *titleLb;
@property (nonatomic,strong)UIView *line;
@end

@implementation CampusListSearchItemCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.titleLb = [[UILabel alloc]init];
        self.titleLb.textColor = C51;
        self.titleLb.font = [UIFont boldSystemFontOfSize:14];
        [self.contentView addSubview:self.titleLb];
        
        [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(self.contentView).offset(20);
            make.right.equalTo(self.contentView).offset(-20);
        }];
        
        self.line = [[UIView alloc]init];
        self.line.backgroundColor = RGBA(230, 230, 230, 1);
        [self.contentView addSubview:self.line];
        [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(20);
            make.right.equalTo(self.contentView).offset(-20);
            make.bottom.equalTo(self.contentView);
            make.height.mas_equalTo(0.5);
        }];
    }
    return self;
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    NSString *ID = @"CampusListSearchItemCell";
    CampusListSearchItemCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[CampusListSearchItemCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}
- (void)setItemModel:(CampusSchoolItemModel *)itemModel{
    _itemModel = itemModel;
    self.titleLb.text = itemModel.name;
}

@end
